The following sample shows how to remove a record from the database. Use this sample as a basis to all business objects of master data type (not documents).
Dim vItem As SAPbobsCOM.Items
Set vItem = vCmp.GetBusinessObject(oItems)
'Retrieve the record to remove from the database
RetVal = vItem.GetByKey("A00043")
If RetVal <> 0 Then
vCmp.GetLastError ErrCode, ErrMsg
MsgBox "Failed to Retrieve the record " & ErrCode & " " & ErrMsg
Exit Sub
End If
'Remove the record from the table in the DB
RetVal = vItem.Remove
If RetVal <> 0 Then
vCmp.GetLastError ErrCode, ErrMsg
MsgBox "Failed to Remove the record " & ErrCode & " " & ErrMsg
Exit Sub
End If